#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.${artifactId};

import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;

public class MyApp
{
    public static final String CHARSET = "UTF-8";

    public static ByteBuffer encode(String string)
            throws UnsupportedEncodingException
    {
        return ByteBuffer.wrap(string.getBytes(CHARSET));
    }

    public static String decode(ByteBuffer buf)
            throws UnsupportedEncodingException
    {
        byte[] bytes = new byte[buf.remaining()];
        buf.get(bytes);
        return new String(bytes, CHARSET);
    }
}